package com.util;

import javax.swing.*;
import java.awt.*;

public class DimensionUtil {

    public static Rectangle getBounds() {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        //保证主界面不会覆盖屏幕电脑的任务栏
        Insets screenInset = Toolkit.getDefaultToolkit()
                .getScreenInsets(new JFrame().getGraphicsConfiguration());

        Rectangle rectangle = new Rectangle(screenInset.left, screenInset.top,
                screenSize.width - screenInset.left - screenInset.right,
                screenSize.height - screenInset.top - screenInset.bottom);
        return rectangle;
    }
}
